using System;
using System.Collections.Generic;
using System.Text;
using Widgetsphere.GeneratorEngine;

namespace Omniture.API.Generators.Objects
{
	internal class EvarRuntimeItemStrongTypeTemplate : BaseTemplate
	{
		private ITrackItem _trackItem = null;

		internal EvarRuntimeItemStrongTypeTemplate(OmnitureProject project, ITrackItem trackItem)
			: base(project)
		{
			_trackItem = trackItem;
		}

		public override string FileContent
		{
			get
			{
				var sb = new StringBuilder();
				sb.AppendLine("using System;");
				sb.AppendLine("using System.Collections.Generic;");
				sb.AppendLine("using System.Linq;");
				sb.AppendLine("using System.Text;");
				sb.AppendLine("");
				sb.AppendLine("namespace Omniture.Plugin.Objects");
				sb.AppendLine("{");
				sb.AppendLine("	internal class " + _trackItem.Name + "EvarRuntimeItem : EvarRuntimeItem");
				sb.AppendLine("	{");
				sb.AppendLine("		public " + _trackItem.Name + "EvarRuntimeItem(string value, bool isRequired)");
				sb.AppendLine("			: base(\"" + _trackItem.Name + "\", value, isRequired)");
				sb.AppendLine("		{");
				sb.AppendLine("		}");
				sb.AppendLine("");
				sb.AppendLine("	}");
				sb.AppendLine("}");
				return sb.ToString();
			}
		}

		public static void Generate(OmnitureProject project, ITrackItem trackItem, string destinationFolder)
		{
			EvarRuntimeItemStrongTypeTemplate t = new EvarRuntimeItemStrongTypeTemplate(project, trackItem);
			t.Generate(destinationFolder);
		}

		public override string FileName
		{
			get { return @"Objects\" + _trackItem.Name + "EvarRuntimeItem.cs"; }
		}

	}
}
